import Phaser, { Scene } from 'phaser'
import { SceneKeys } from '~/consts/Keys'

export default class GameOverScene extends Phaser.Scene {
  textY: number = 0.4

  constructor () {
    super(SceneKeys.GameOver)
  }
  init () {
    this.textY = 0.4
  }
  create () {
    const { width, height } = this.scale
    this.addText('Press SPACE to Play Again', 32)
  }
  addText (text: string, fontSize: number): void {
    const { width, height } = this.scale
    this.add.text(
      width * 0.5,
      height * this.textY,
      text,
      {
        fontSize: fontSize + 'px',
        color: '#fff',
        backgroundColor: '#000',
        shadow: { fill: true, blur: 0, offsetY: 0},
        padding: { left: 15, right: 15, top: 10, bottom: 10 }
      }
    ).setOrigin(0.5)
    this.textY += fontSize / 480
  }
}